﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebSite
{
    public partial class CreateUserPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CreateAccount_button_Click(object sender, EventArgs e)
        {
            WebService.SOAPServiceClient webservice = new WebService.SOAPServiceClient();
            WebService.Users authUser = new WebService.Users();

            string username = UserName_TextBox.Text;
            string password = Password_textBox.Text;
            int balance = 0;

            if (!string.IsNullOrEmpty(username) && (!string.IsNullOrEmpty(password)))
            {

                webservice.createUser(username, password, balance);
                Session["UserName"] = username;
                Session["isUserLoggedIn"] = "true";
                Response.Redirect("MainPage.aspx");
            }
            else
            {
                CreateUser_Label.Visible = true;
            }
        }
    }
}